Challenge 9: Formatting Nice Tables
For this Challenge you will explore how to generate nice looking tables for HTML documents, by applying the skills to your Lab 9. There are many packages for generating tables, but I prefer the kable() function from the knitr package for simple tables and the gt() function from the DT package for more sophisticated tables.
I would recommend you think of tables no different from the visualizations you’ve been making. We want all aspects of our tables to be clear to the reader, so the comparisons we want them to make are straightforward. Tables are also a great avenue to display creativity! In fact, there is a yearly RStudio table contest, and here is a gallery of the award winning tables!
1 Formatting Basic Tables
Use the kable() function from the kable package to create nice, basic HTML tables for every table in Lab 9.
Similar to axis labels in visualizations, every column name in a table should describe what it contains. For example, a column of n is less explanatory than Frequency of Babies.
2 Formatting Nicer Tables
There are two options for creating nicer tables: + kableExtra package + DT Package.
Use either the DT or kableExtra packages to spice up at least one of your tables. Some ideas on how to “spice up” a table: change the font and / or font size, adding striping and / or cell borders to the table, creating custom formatting of columns, or allowing the user to interact with the table (e.g., filtering columns, editing cells).